from time import sleep
from unittest import TestCase

from selenium import webdriver

from teacher.ecshop.po.LoginPage import LoginPage
from teacher.ecshop.utils.Config import Config


class TestLogin(TestCase):
    file = './config/config.ini'  # 文件路径为自己的包路径
    config = Config(file)

    def testLogin(self):
        self.driver = webdriver.Chrome(self.config.get_value(self.file, 'system', 'driver'))
        login = LoginPage(self.driver)
        login.open(self.config.get_value(self.file, 'system', 'url'))
        login.input_username()
        login.input_password()
        login.click_login_button()
        sleep(3)
